Quản lý sinh viên sử dụng vb.net + sql server
22.430 lượt xem;
1 create database SV
2 create table thogntin(
3 MSV nvarchar(5),
4 TEN nvarchar(50),
5 LOP char(4),
6 DIEM float,
7 )
8 create proc pr_timkiem
9 (@MSV nvarchar(5),
10 @HoTen nvarchar(50)
11 )
12 as
13 select * from thogntin where TEN like 'N%' + @HoTen + '%'
14 select 12345 from thogntin where MSV
15
16 truncate table thogntin
17 create proc pr_themsinhvien
18 (@MSV nvarchar(5),
19 @HoTen nvarchar(50),
20 @Lop char(4),
21 @Diem float
22 )
23 as
24 if exists(select * from thogntin where MSV=@MSV and TEN=@HoTen and LOP=@Lop and DIEM=@Diem)
25 select ErrCode=1,ErrMsg=N'Đã tồn tài dữ liệu này!'
26 else
27 begin
28 insert into thogntin(MSV,TEN,LOP,DIEM) values(@MSV,@HoTen,@Lop,@Diem)
29 if(@@ROWCOUNT>0)
30 select ErrCode=0,ErrMsg=N'Thêm thành công !!'
31 else
32 select ErrCode=1,ErrMsg=N'Có lỗi xảy ra!'
33 end
34 create proc xoasv(
35 @MSV nvarchar(5)
36 )
37 as
38 delete from thogntin where MSV = @MSV
39 create proc suasv(
40 @Diem float
41 )
42 as
43 update DIEM set @Diem ='%' where DIEM
2 create table thogntin(
3 MSV nvarchar(5),
4 TEN nvarchar(50),
5 LOP char(4),
6 DIEM float,
7 )
8 create proc pr_timkiem
9 (@MSV nvarchar(5),
10 @HoTen nvarchar(50)
11 )
12 as
13 select * from thogntin where TEN like 'N%' + @HoTen + '%'
14 select 12345 from thogntin where MSV
15
16 truncate table thogntin
17 create proc pr_themsinhvien
18 (@MSV nvarchar(5),
19 @HoTen nvarchar(50),
20 @Lop char(4),
21 @Diem float
22 )
23 as
24 if exists(select * from thogntin where MSV=@MSV and TEN=@HoTen and LOP=@Lop and DIEM=@Diem)
25 select ErrCode=1,ErrMsg=N'Đã tồn tài dữ liệu này!'
26 else
27 begin
28 insert into thogntin(MSV,TEN,LOP,DIEM) values(@MSV,@HoTen,@Lop,@Diem)
29 if(@@ROWCOUNT>0)
30 select ErrCode=0,ErrMsg=N'Thêm thành công !!'
31 else
32 select ErrCode=1,ErrMsg=N'Có lỗi xảy ra!'
33 end
34 create proc xoasv(
35 @MSV nvarchar(5)
36 )
37 as
38 delete from thogntin where MSV = @MSV
39 create proc suasv(
40 @Diem float
41 )
42 as
43 update DIEM set @Diem ='%' where DIEM